
PREFIX=$(INSTALL_ROOT)/usr
#PREFIX=./tmp/build

CONF_PREFIX=$(PREFIX)

DATA_PATH=$(PREFIX)/share/diskmuster
DOC_PATH=$(PREFIX)/share/doc/packages/diskmuster
#TRANSLATION_PATH shouldn't be changed until code is rewritten
TRANSLATION_PATH=$(PREFIX)/share/diskmuster/translations
SHORTCUTS_PATH=$(PREFIX)/share/diskmuster/shortcuts

KDE_PREFIX=$(PREFIX)

KDE_ICONS=$(KDE_PREFIX)/share/icons/hicolor
KDE_APPLNK=$(KDE_PREFIX)/share/applications

QMAKE=qmake-qt4
LRELEASE=lrelease-qt4

DEFS=DATA_PATH=\\\"$(DATA_PATH)\\\" \
     TRANSLATION_PATH=\\\"$(TRANSLATION_PATH)\\\" \
     DOC_PATH=\\\"$(DOC_PATH)\\\" THEMES_PATH=\\\"$(THEMES_PATH)\\\" \
     SHORTCUTS_PATH=\\\"$(SHORTCUTS_PATH)\\\"


src/bin/diskmuster:
	cd src && $(QMAKE) $(QMAKE_OPTS) && $(DEFS) make
	cd src && $(LRELEASE) DiskMuster.pro

clean:
	cd src && make distclean
	-rm src/langs/diskmuster_*.qm

install: src/bin/diskmuster
	-install -d $(DESTDIR)$(PREFIX)/bin/
	install -m 755 src/bin/diskmuster $(DESTDIR)$(PREFIX)/bin/
	-install -d $(DESTDIR)$(TRANSLATION_PATH)
	install -m 644 src/langs/*.qm $(DESTDIR)$(TRANSLATION_PATH)

	-install -d $(DESTDIR)$(KDE_ICONS)/64x64/apps/
	-install -d $(DESTDIR)$(KDE_ICONS)/32x32/apps/
	-install -d $(DESTDIR)$(KDE_ICONS)/22x22/apps/
	-install -d $(DESTDIR)$(KDE_ICONS)/16x16/apps/
	install -m 644 icons/diskmuster_icon64.png $(DESTDIR)$(KDE_ICONS)/64x64/apps/diskmuster.png
	install -m 644 icons/diskmuster_icon32.png $(DESTDIR)$(KDE_ICONS)/32x32/apps/diskmuster.png
	install -m 644 icons/diskmuster_icon22.png $(DESTDIR)$(KDE_ICONS)/22x22/apps/diskmuster.png
	install -m 644 icons/diskmuster_icon16.png $(DESTDIR)$(KDE_ICONS)/16x16/apps/diskmuster.png
	-install -d $(DESTDIR)$(KDE_APPLNK)
	install -m 644 diskmuster.desktop $(DESTDIR)$(KDE_APPLNK)
	-install -d $(DESTDIR)$(PREFIX)/share/man/man1/
	install -m 644 man/diskmuster.1 $(DESTDIR)$(PREFIX)/share/man/man1/
	gzip -9 -f $(DESTDIR)$(PREFIX)/share/man/man1/diskmuster.1

uninstall:
	-rm -f $(PREFIX)/bin/diskmuster
	-rm -f $(TRANSLATION_PATH)/*.qm
	-rm -f $(KDE_ICONS)/64x64/apps/diskmuster.png
	-rm -f $(KDE_ICONS)/32x32/apps/diskmuster.png
	-rm -f $(KDE_ICONS)/22x22/apps/diskmuster.png
	-rm -f $(KDE_ICONS)/16x16/apps/diskmuster.png
	-rm -f $(KDE_APPLNK)/diskmuster.desktop
	-rm -f $(PREFIX)/share/man/man1/diskmuster.1.gz
	-rmdir $(TRANSLATION_PATH)/
	-rmdir $(DATA_PATH)/

